package com.hehe.httpurlconnectiontest2;

import android.util.Log;

/**
 * Created by lenove on 2017/11/12
 *
 * yeelink数据点类.
 */

public class YeelinkDataPoint {
    private String timestamp ;//设备id
    private String value;//传感器id


    YeelinkDataPoint(String timestamp,String value){
        this.timestamp = timestamp;
        this.value = value;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public String getValue() {
        return value;
    }

    //这个类将时间戳转为日常习惯的日期
    public String getTime(){
        if (timestamp!=null){
            String[] buffer = timestamp.split("-|T");
            String time = buffer[0]+"年"+buffer[1]+"月"+buffer[2]+"日 "+buffer[3];
            Log.i("time",time);
            return time;
        }else {
            return null;
        }
    }
}
